package com.atbeijing.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark12_Oper_Transform {

    def main(args: Array[String]): Unit = {

        val conf = new SparkConf().setMaster("local[*]").setAppName("TransformOperator")
        val sc = new SparkContext(conf)

        // TODO 算子 - 转换 - sortBy

        val rdd = sc.makeRDD(List(1,2,6,4,5,3), 2)
        //val rdd = sc.makeRDD(List(new User(), new User()), 2)

        // Int => K
        //rdd.groupBy()
        // Int（数据值） => K(排序的值)
        // 1 => "1"
        // 2 => "2"
        //11 => "11"
        rdd.sortBy(num=>num, false)

        //List(1,2,3).sortBy(num=>num)(Ordering.Int.reverse)


        sc.stop()

    }
    class User {

    }
}
